home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Text / Extension Dev. Kit / Extension Sources / Interfaces / ExternalInterface.p < prev    next >
Encoding:
Text File  |  1993-05-09  |  4.0 KB  |  135 lines  |  [TEXT/PJMM]

  1. unit ExternalInterface;
  2. interface
  3.  
  4. {    Interface structure definition. This structure is for reference only; you should not    }
  5. {    modify any of its fields. It will also be most convenient for you to use the library        }
  6. {    routines (declared below) to call the functions in the callback block.                        }
  7.  
  8.     type
  9.         ExternalCallbackBlock = record
  10.                 version: Integer;
  11.  
  12.         {    the callback routines are abstracted away for greater convenience when used        }
  13.         {    from Pascal.                                                                                }
  14.                 callbacks: array[0..0] of ProcPtr;
  15.             end;
  16.         ExternalCallbackPtr = ^ExternalCallbackBlock;
  17.  
  18. {    This data type is used in the "OpenSeveral" call.    }
  19.     type
  20.         ReplyList = array[0..255] of StandardFileReply;
  21.         ReplyListPtr = ^ReplyList;
  22.         ReplyListHandle = ^ReplyListPtr;
  23.  
  24. {    This data type is used by the "GetProjectList" call.    }
  25.     type
  26.         ProjectEntry = record
  27.                 spec: FSSpec;
  28.  
  29.                 treeID: SignedByte;
  30.                 found: Boolean;
  31.  
  32.                 fType: OSType;
  33.                 fCrtr: OSType;
  34.             end;
  35.  
  36.         ProjectEntryArray = array[0..255] of ProjectEntry;
  37.         ProjectEntryArrayPtr = ^ProjectEntryArray;
  38.         ProjectEntryArrayHandle = ^ProjectEntryArrayPtr;
  39.  
  40. {    This routine should be called as the FIRST THING in your external's main routine.            }
  41.     procedure PrepareCallbacks (callbacks: ExternalCallbackPtr);
  42.  
  43. {    Your "main" should be declared thus:                                            }
  44. {    PROCEDURE Main(callbacks : ExternalCallbackPtr; w:WindowPtr);            }
  45.  
  46. {    External callback routines.     }
  47.  
  48. {    Version 1 callbacks            }
  49.     function GetWindowContents (w: WindowPtr): Handle;
  50.     procedure GetSelection (var selStart, selEnd, firstChar: LongInt);
  51.     procedure SetSelection (selStart, selEnd, firstChar: LongInt);
  52.     procedure GetDocInfo (w: WindowPtr;
  53.                                     var fName: Str255;
  54.                                     var vRefNum: Integer;
  55.                                     var dirID: LongInt);
  56.     function GetModDate (w: WindowPtr): LongInt;
  57.     function CopyText: Handle;
  58.     procedure PasteText (pasteText: Handle);
  59.  
  60. {    Version 2 callbacks    }
  61.     function GetLastLine: LongInt;
  62.     function GetLineNumber (selection: LongInt): LongInt;
  63.     function GetLineStart (selection: LongInt): LongInt;
  64.     function GetLineEnd (selection: LongInt): LongInt;
  65.     function GetLinePos (line: LongInt): LongInt;
  66.  
  67.     procedure InsertText (text: univ Ptr;
  68.                                     len: LongInt);
  69.     procedure DeleteText;
  70.  
  71.     procedure SetWindowContents (w: WindowPtr;
  72.                                     h: Handle);
  73.     procedure ContentsChanged (w: WindowPtr);
  74.  
  75.     function GetFiletext (vRefNum: Integer;
  76.                                     dirID: LongInt;
  77.                                     fName: Str255;
  78.                                     var canDispose: Boolean): Handle;
  79.  
  80.     function GetFolder (prompt: Str255;
  81.                                     var vRefNum: Integer;
  82.                                     var dirID: LongInt): Boolean;
  83.     function OpenSeveral (sort: Boolean;
  84.                                     var fileCount: LongInt;
  85.                                     var files: ReplyListHandle): Boolean;
  86.  
  87.     function CenterDialog (dialogID: Integer): DialogPtr;
  88.     function StandardFilter (d: DialogPtr;
  89.                                     var event: EventRecord;
  90.                                     var item: Integer): Boolean;
  91.     procedure FrameDialogItem (d: DialogPtr;
  92.                                     item: Integer);
  93.  
  94.     function NewDocument: WindowPtr;
  95.     function OpenDocument: WindowPtr;
  96.  
  97.     function AllocateMemory (size: LongInt;
  98.                                     clear: Boolean): Handle;
  99.     function FindPattern (text: univ Ptr;
  100.                                     textLen: LongInt;
  101.                                     textOffset: LongInt;
  102.                                     pattern: univ Ptr;
  103.                                     patLen: LongInt;
  104.                                     caseSensitive: Boolean): LongInt;
  105.     procedure ReportOSError (code: OSErr);
  106.  
  107.     procedure GetPreference (prefType: ResType;
  108.                                     reqLen: Integer;
  109.                                     buffer: univ Ptr;
  110.                                     var actLen: Integer);
  111.     procedure SetPreference (prefType: ResType;
  112.                                     reqLen: Integer;
  113.                                     buffer: univ Ptr;
  114.                                     var actLen: Integer);
  115.  
  116.     procedure StartProgress (str: Str255;
  117.                                     total: LongInt;
  118.                                     cancelAllowed: Boolean);
  119.     function DoProgress (done: LongInt): Boolean;
  120.     procedure DoneProgress;
  121.  
  122. {    Version 3 callbacks.    }
  123.     function GetProjectList (spec: FSSpec;
  124.                                     var projectKind: Integer;
  125.                                     var count: Integer;
  126.                                     var list: ProjectEntryArrayHandle): Boolean;
  127.  
  128.     function ProjectTextList (spec: FSSpec;
  129.                                     var textList: Handle): Boolean;
  130.  
  131. implementation
  132.  
  133. {    All routines declared above are defined in "ExternalInterface.Lib".            }
  134.  
  135. end.